function Photogallery(){
	var self = this;
	
	self.init = function(){
		
		$(".fileFromSys").live("click", function(){
			
			var id_file = $(this).find(".id_file").val();
			var thumb = $(this).parent().find("img").attr("src");
			
			$("#pictures").append("<div class='picture' id='pic-"+id_file+"'><img src='"+thumb+"' /><input type='hidden' name='id_files[]' value='"+id_file+"' /><span onclick='photogallery.deletePicture("+id_file+")'>&times;</span><br /><input type='text' name='files_title[]' /><input type='radio' name='hlavni' value='"+id_file+"' /></div>");
		});
	};
	
	self.deletePicture = function(id_file){
		$("#pic-" + id_file).remove();
	}
	
	$(".jq_galleryDelete").live("click", function(){
		
		if(confirm("Opravdu si přejete smazat tuto galerii?"))
			return true;
		else		
			return false;
	});
}

var photogallery = new Photogallery();

$(document).ready(function(){
	photogallery.init();
});